{include file='_header'}
<div class="page-header">
	当前位置：<span class="text-primary">分类管理</span>
</div>

<div class="page-content">
<div class="alert alert-primary">提示: 排序数字越大越靠前; 如果设置该分类不显示则消息列表中不会出现此类文章;</div>
<form action="{:url('admin/article/categorysave')}" method="post" class="form-validate">

	<table class="table table-hover  table-responsive">
		<thead class="navbar-inner">
			<tr>
				<th style="width:60px;">ID</th>
				<th style="width:60px;">排序</th>
				<th>分类名称</th>
				<th style="width:60px;">显示</th>
				<th style="width:80px;">操作</th>
			</tr>
		</thead>
		<tbody id='tbody-items'>
			{foreach name='list' item='row'}
			<tr>
				<td>
					{$row['id']}
				</td>
				<td>
					<input type="text" class="form-control" name="cate[{$row['id']}][displayorder]" value="{$row['displayorder']}"> 
				</td>
				<td>
					<input type="text" class="form-control" name="cate[{$row['id']}][name]" value="{$row['category_name']}"> 
				</td>
				<td>
					<input type="checkbox" name="cate[{$row['id']}][isshow]" value="1" {if !empty($row['isshow'])} checked="checked"{/if}>
				</td>
				<td>
					<a data-toggle="ajaxRemove" href="{:url('admin/article/categorydelete', array('id' => $row['id']))}" class="btn btn-default btn-sm btn-op btn-operation" data-confirm="确认删除此分类?">
						<span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                            <i class='icow icow-shanchu1'></i>
                       </span>
					</a>
				</td>
				</td>
			</tr>
			{/foreach}
		</tbody>
		<tr>
			<td colspan="5">
				<input type="button" class="btn btn-default" value="添加分类" onclick='addCategory()'> 
				<input type="submit" class="btn btn-primary" value="保存分类"> 
			</td> 
		</tr>
	</table>
	{$pager}
</form>
</div>
<script>
	function addCategory() {
		var html = '<tr>';
		html += '<td><i class="fa fa-plus"></i></td>';
		html += '<td></td>';
		html += '<td>';
		html += '<input type="text" class="form-control" name="cate_new[]" value="">';
		html += '</td>';
		html += '<td></td>';
		html += '<td></td></tr>';;
		$('#tbody-items').append(html);
	}
</script>

{include file='_footer'}